package com.atguigu.yygh.hosp.controller.admin;

import com.atguigu.yygh.common.result.R;
import com.atguigu.yygh.hosp.service.ScheduleService;
import com.atguigu.yygh.model.hosp.Schedule;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/admin/schedule")
public class ScheduleController {
    @Autowired
    private ScheduleService scheduleService;

    //查询排班聚合分页信息
    @GetMapping("/{pageNum}/{pageSize}/{hoscode}/{depcode}")
    public R getSchedulePage(@PathVariable Integer pageNum,@PathVariable Integer pageSize,@PathVariable String hoscode,@PathVariable String depcode){
        Map<String,Object> map = scheduleService.getSchedulePage(pageNum,pageSize,hoscode,depcode);
        return R.ok().data(map);
    }

    //排班详情
    @GetMapping("/{hoscode}/{depcode}/{workDate}")
    public R detail(@PathVariable String hoscode,@PathVariable String depcode,@PathVariable String workDate){

        List<Schedule> scheduleList = scheduleService.getScheduleDetail(hoscode,depcode,workDate);
        return R.ok().data("items",scheduleList);
    }
}